home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
-
- main()
- {
- int graphdriver = DETECT, graphmode,
- lomode, himode, mode, c;
- char buffer[80];
-
- /* Detect and initialize graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
-
- /* Now call getmoderange to determine the range of
- * modes supported by this adapter. Switch to each
- * mode and draw a filled box in each mode.
- */
-
- getmoderange(graphdriver, &lomode, &himode);
- for(mode = lomode; mode <= himode; mode++)
- {
- setgraphmode(mode);
- sprintf(buffer,"Now in graphics mode %d", mode);
- outtextxy(10,10, buffer);
- setfillstyle(SOLID_FILL,RED);
- bar(50,50, 150,100);
- outtextxy(10, getmaxy() - 50, "Press 'q' to exit, or any other key"
- "to switch mode");
- if((c = getch()) == 'q') break;
- }
- closegraph();
- }